From d9569740fbda885f516cd7453f9d1136a7b2f39a Mon Sep 17 00:00:00 2001 From: "mafetter@fleming.research" Date: Thu, 24 Mar 2005 22:01:27 +0000 Subject: [PATCH] bitkeeper revision 1.1261.1.1 (424338b72O4irc499IhwoNUikHMy5Q) Minor cleanups, in preparation for merging with mainline. Removal of some debug hooks. Signed-off-by: michael.fetterman@cl.cam.ac.uk --- xen/arch/x86/domain.c | 4 +- xen/arch/x86/domain_build.c | 6 +-- xen/arch/x86/mm.c | 6 +-- xen/arch/x86/shadow.c | 25 ++++++++----- xen/arch/x86/x86_32/asm-offsets.c | 6 --- xen/arch/x86/x86_32/domain_page.c | 8 +--- xen/common/page_alloc.c | 11 +----- xen/include/asm-x86/mm.h | 47 +----------------------- xen/include/asm-x86/shadow.h | 1 + xen/include/asm-x86/x86_32/domain_page.h | 18 +-------- 10 files changed, 30 insertions(+), 102 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 8a88488ebe..03bc222ec2 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -238,7 +238,7 @@ void arch_do_createdomain(struct exec_domain *ed) d->shared_info = (void *)alloc_xenheap_page(); memset(d->shared_info, 0, PAGE_SIZE); ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid]; - SHARE_PFN_WITH_DOMAIN2(virt_to_page(d->shared_info), d); + SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d); machine_to_phys_mapping[virt_to_phys(d->shared_info) >> PAGE_SHIFT] = INVALID_M2P_ENTRY; @@ -262,7 +262,7 @@ void arch_do_createdomain(struct exec_domain *ed) mk_l3_pgentry(__pa(d->arch.mm_perdomain_l2) | __PAGE_HYPERVISOR); #endif - shadow_lock_init(d); + shadow_lock_init(d); INIT_LIST_HEAD(&d->arch.free_shadow_frames); } } diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index 52fcfe7760..53514d1464 100644 --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -426,7 +426,7 @@ int construct_dom0(struct domain *d, d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1; d->shared_info->n_vcpu = smp_num_cpus; - /* setup monitor table */ + /* Set up monitor table */ update_pagetables(ed); /* Install the new page tables. */ @@ -472,12 +472,10 @@ int construct_dom0(struct domain *d, for ( pfn = 0; pfn < d->tot_pages; pfn++ ) { mfn = pfn + (alloc_start>>PAGE_SHIFT); -#if 0 #ifndef NDEBUG #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT) - if ( pfn > REVERSE_START ) + if ( !opt_dom0_translate && (pfn > REVERSE_START) ) mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START); -#endif #endif ((u32 *)vphysmap_start)[pfn] = mfn; machine_to_phys_mapping[mfn] = pfn; diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index d2ec59336b..55af653c0f 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1088,7 +1088,7 @@ void free_page_type(struct pfn_info *page, unsigned int type) } -void _put_page_type(struct pfn_info *page) +void put_page_type(struct pfn_info *page) { u32 nx, x, y = page->u.inuse.type_info; @@ -1143,7 +1143,7 @@ void _put_page_type(struct pfn_info *page) } -int _get_page_type(struct pfn_info *page, u32 type) +int get_page_type(struct pfn_info *page, u32 type) { u32 nx, x, y = page->u.inuse.type_info; @@ -1880,7 +1880,7 @@ int do_mmu_update( case MMU_MACHPHYS_UPDATE: - // HACK ALERT... This about this later... + // HACK ALERT... Need to think about this some more... // if ( unlikely(shadow_mode_translate(FOREIGNDOM) && IS_PRIV(d)) ) { diff --git a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c index 900dd910df..435afa45b0 100644 --- a/xen/arch/x86/shadow.c +++ b/xen/arch/x86/shadow.c @@ -2,6 +2,7 @@ * arch/x86/shadow.c * * Copyright (c) 2005 Michael A Fetterman + * Based on an earlier implementation by Ian Pratt et al * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -658,11 +659,6 @@ set_p2m_entry(struct domain *d, unsigned long pfn, unsigned long mfn) ASSERT( phystab ); -#ifdef WATCH_MAP_DOMAIN_CALLERS - int old_map_domain_mem_noisy = map_domain_mem_noisy; - map_domain_mem_noisy = 0; -#endif - l2 = map_domain_mem(phystab); if ( !l2_pgentry_val(l2e = l2[l2_table_offset(va)]) ) { @@ -685,10 +681,6 @@ set_p2m_entry(struct domain *d, unsigned long pfn, unsigned long mfn) __PAGE_HYPERVISOR); unmap_domain_mem(l1); -#ifdef WATCH_MAP_DOMAIN_CALLERS - map_domain_mem_noisy = old_map_domain_mem_noisy; -#endif - return 1; } @@ -722,6 +714,21 @@ alloc_p2m_table(struct domain *d) list_ent = page->list.next; } + list_ent = d->xenpage_list.next; + while ( list_ent != &d->xenpage_list ) + { + page = list_entry(list_ent, struct pfn_info, list); + mfn = page_to_pfn(page); + pfn = machine_to_phys_mapping[mfn]; + if ( (pfn != INVALID_M2P_ENTRY) && + (pfn < (1u<<20)) ) + { + set_p2m_entry(d, pfn, mfn); + } + + list_ent = page->list.next; + } + return 1; } diff --git a/xen/arch/x86/x86_32/asm-offsets.c b/xen/arch/x86/x86_32/asm-offsets.c index e2f8f6cfb7..1733fb1240 100644 --- a/xen/arch/x86/x86_32/asm-offsets.c +++ b/xen/arch/x86/x86_32/asm-offsets.c @@ -6,7 +6,6 @@ #include #include -#include #define DEFINE(_sym, _val) \ __asm__ __volatile__ ( "\n->" #_sym " %0 " #_val : : "i" (_val) ) @@ -76,9 +75,4 @@ void __dummy__(void) BLANK(); DEFINE(FIXMAP_apic_base, fix_to_virt(FIX_APIC_BASE)); - -#if PERF_COUNTERS - OFFSET(PERFC_hypercalls, struct perfcounter, hypercalls); - OFFSET(PERFC_exceptions, struct perfcounter, exceptions); -#endif } diff --git a/xen/arch/x86/x86_32/domain_page.c b/xen/arch/x86/x86_32/domain_page.c index b0eab61730..2feeaebb3d 100644 --- a/xen/arch/x86/x86_32/domain_page.c +++ b/xen/arch/x86/x86_32/domain_page.c @@ -26,11 +26,6 @@ static spinlock_t map_lock = SPIN_LOCK_UNLOCKED; /* Use a spare PTE bit to mark entries ready for recycling. */ #define READY_FOR_TLB_FLUSH (1<<10) -#ifdef WATCH_MAP_DOMAIN_CALLERS -int map_domain_mem_noisy = 1; -#endif - - static void flush_all_ready_maps(void) { unsigned long *cache = mapcache; @@ -43,7 +38,8 @@ static void flush_all_ready_maps(void) while ( ((unsigned long)(++cache) & ~PAGE_MASK) != 0 ); } -void *_map_domain_mem(unsigned long pa) + +void *map_domain_mem(unsigned long pa) { unsigned long va; unsigned int idx, cpu = smp_processor_id(); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 097008b9f3..46536bae18 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -350,11 +350,6 @@ void scrub_heap_pages(void) printk("Scrubbing Free RAM: "); -#ifdef WATCH_MAP_DOMAIN_CALLERS - int old_map_domain_mem_noisy = map_domain_mem_noisy; - map_domain_mem_noisy = 0; -#endif - for ( pfn = 0; pfn < (bitmap_size * 8); pfn++ ) { /* Every 100MB, print a progress dot and appease the watchdog. */ @@ -381,10 +376,6 @@ void scrub_heap_pages(void) spin_unlock_irqrestore(&heap_lock, flags); } -#ifdef WATCH_MAP_DOMAIN_CALLERS - map_domain_mem_noisy = old_map_domain_mem_noisy; -#endif - printk("done.\n"); } @@ -599,7 +590,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order) pg[i].count_info, pg[i].u.inuse.type_info); } - ASSERT( (pg[i].u.inuse.type_info & PGT_count_mask) == 0 ); + ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0); pg[i].tlbflush_timestamp = tlbflush_current_time(); pg[i].u.free.cpu_mask = cpu_mask; list_del(&pg[i].list); diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index 8ddee7e254..1c9796df37 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -148,21 +148,6 @@ static inline u32 pickle_domptr(struct domain *domain) list_add_tail(&(_pfn)->list, &(_dom)->xenpage_list); \ spin_unlock(&(_dom)->page_alloc_lock); \ } while ( 0 ) -#define SHARE_PFN_WITH_DOMAIN2(_pfn, _dom) \ - do { \ - page_set_owner((_pfn), (_dom)); \ - /* The incremented type count is intended to pin to 'writable'. */ \ - (_pfn)->u.inuse.type_info = PGT_writable_page | PGT_validated | 1; \ - wmb(); /* install valid domain ptr before updating refcnt. */ \ - spin_lock(&(_dom)->page_alloc_lock); \ - /* _dom holds an allocation reference + writable ref */ \ - ASSERT((_pfn)->count_info == 0); \ - (_pfn)->count_info |= PGC_allocated | 2; \ - if ( unlikely((_dom)->xenheap_pages++ == 0) ) \ - get_knownalive_domain(_dom); \ - list_add_tail(&(_pfn)->list, &(_dom)->page_list); \ - spin_unlock(&(_dom)->page_alloc_lock); \ - } while ( 0 ) extern struct pfn_info *frame_table; extern unsigned long frame_table_size; @@ -225,36 +210,8 @@ static inline int get_page(struct pfn_info *page, return 1; } -//#define MFN1_TO_WATCH 0x1d8 -#ifdef MFN1_TO_WATCH -#define get_page_type(__p, __t) ( \ -{ \ - struct pfn_info *_p = (__p); \ - u32 _t = (__t); \ - if ( page_to_pfn(_p) == MFN1_TO_WATCH ) \ - printk("get_page_type(%x) c=%p ot=%p @ %s:%d in %s\n", \ - MFN1_TO_WATCH, frame_table[MFN1_TO_WATCH].count_info, \ - frame_table[MFN1_TO_WATCH].u.inuse.type_info, \ - __FILE__, __LINE__, __func__); \ - _get_page_type(_p, _t); \ -}) -#define put_page_type(__p) ( \ -{ \ - struct pfn_info *_p = (__p); \ - if ( page_to_pfn(_p) == MFN1_TO_WATCH ) \ - printk("put_page_type(%x) c=%p ot=%p @ %s:%d in %s\n", \ - MFN1_TO_WATCH, frame_table[MFN1_TO_WATCH].count_info, \ - frame_table[MFN1_TO_WATCH].u.inuse.type_info, \ - __FILE__, __LINE__, __func__); \ - _put_page_type(_p); \ -}) -#else -#define _get_page_type get_page_type -#define _put_page_type put_page_type -#endif - -void _put_page_type(struct pfn_info *page); -int _get_page_type(struct pfn_info *page, u32 type); +void put_page_type(struct pfn_info *page); +int get_page_type(struct pfn_info *page, u32 type); int get_page_from_l1e(l1_pgentry_t l1e, struct domain *d); void put_page_from_l1e(l1_pgentry_t l1e, struct domain *d); diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index ce6198aed9..e2f1e4f8b9 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -2,6 +2,7 @@ * include/asm-x86/shadow.h * * Copyright (c) 2005 Michael A Fetterman + * Based on an earlier implementation by Ian Pratt et al * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/xen/include/asm-x86/x86_32/domain_page.h b/xen/include/asm-x86/x86_32/domain_page.h index f86b022d9a..d8cdf0b74e 100644 --- a/xen/include/asm-x86/x86_32/domain_page.h +++ b/xen/include/asm-x86/x86_32/domain_page.h @@ -13,28 +13,12 @@ extern unsigned long *mapcache; #define MAPCACHE_ENTRIES 1024 - -//#define WATCH_MAP_DOMAIN_CALLERS 1 -#ifdef WATCH_MAP_DOMAIN_CALLERS -extern int map_domain_mem_noisy; -#define map_domain_mem(__mdm_pa) ( \ -{ \ - unsigned long _mdm_pa = (__mdm_pa); \ - if ( map_domain_mem_noisy ) \ - printk("map_domain_mem(%p) @ %s:%d in %s\n", \ - _mdm_pa, __FILE__, __LINE__, __func__); \ - _map_domain_mem(_mdm_pa); \ -}) -#else -#define _map_domain_mem map_domain_mem -#endif - /* * Maps a given physical address, returning corresponding virtual address. * The entire page containing that VA is now accessible until a * corresponding call to unmap_domain_mem(). */ -extern void *_map_domain_mem(unsigned long pa); +extern void *map_domain_mem(unsigned long pa); /* * Pass a VA within a page previously mapped with map_domain_mem(). -- 2.30.2